<template>
  <div>
    <div ref="myBox">我是div盒子</div>
    <MyModal ref="myModal" />
    <button @click="fn">按钮</button>
  </div>
</template>

<script>
import MyModal from '@/components/MyModal.vue'

export default {
  components: {
    MyModal,
  },

  methods: {
    fn() {
      //$refs就是所有ref的集合
      // this.$refs.myBox.innerText = '我要去写代码'
      // console.log(this.$refs)
      // console.log(this.$refs.myModal)
      // this.$refs.myModal.sayHi()
      console.log(this.$refs.myModal.sonValue)
      console.log(this)
    },
  },
}
</script>

<style scoped></style>
